import axios from 'axios';
import React, { useState, useEffect } from 'react'
import { Link } from 'react-router-dom'
const Model = () => {

  const [list, setList] = useState([]);
  useEffect(() => {
    const url = "http://192.168.72.166:8080/api/getModelDatas";
    axios.get(url).then(res => {
      const data = res.data.data;
      data.forEach((item) => {
        let img = "http://192.168.72.166:8080/" + item.model_image;
        item.model_image = img;
      });
      setList(data)
    })
  }, [])
  return (
    <div className='model'>
      <div className='m-1-1'>
        <Link to='/work/2D'><img src={require('../../images/地毯.jpg')} /></Link>
        <p>地毯</p>
      </div>
      {
        list.map(item => {
          return (
            <div className='m-1-1'>
              <Link to='/work/2D'><img src={item.model_image} /></Link>
              <p>{item.model_name}</p>
            </div>
          )
        })
      }
    </div>
  )
}

export default Model
